package com.bytech.common.biz.enums.friendChain;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.bytech.common.biz.enums.comment.CommentStatusEnum;
import com.bytech.common.utils.StringUtils;
import com.google.common.collect.ImmutableList;
import lombok.Data;
import lombok.Getter;

/**
 * @Author Zhao
 * @Create 2021/10/8 16:12
 */
@Getter
public enum FriendChainAuditStatusEnum {

    UNKNOWN("unknown", "未知"),
    APPLY("apply", "已申请"),
    REJECT("reject", "已拒绝"),
    PASS("pass", "已通过"),
    ;

    private final String value;
    private final String desc;

    FriendChainAuditStatusEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    private static final Map<String, FriendChainAuditStatusEnum> map = new HashMap<>(FriendChainAuditStatusEnum.values().length);

    static {
        for (FriendChainAuditStatusEnum e : FriendChainAuditStatusEnum.values()) {
            map.put(e.value, e);
        }
    }

    public static FriendChainAuditStatusEnum of(String state) {
        if (StringUtils.isBlank(state)) {
            return UNKNOWN;
        }
        return map.get(state) == null ? UNKNOWN : map.get(state);
    }

    public static List<FriendChainAuditStatusEnum> validValues() {
        return ImmutableList.of(APPLY, REJECT, PASS);
    }

}
